﻿/*****************************************************************//**
 * @file    FITKGraphObjectConstraintCoupling.h
 * @brief   Graph object for 'coupling'.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-04-22
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTCONSTRAINCOUPLING_H__
#define __FITKGRAPHOBJECTCONSTRAINCOUPLING_H__

#include "FITKGraphObjectInteractionBase.h"

#include "FITKVTKGraphAdaptorAPI.h"

// Forward declaration
namespace Interface
{
    class FITKAbaConstraintCoupling;
}

namespace Exchange
{
    /**
     * @brief   Graph object for 'coupling'.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-04-22
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectConstraintCoupling : public FITKGraphObjectInteractionBase
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectConstraintCoupling, FITKGraphObjectInteractionBase);
        FITKCLASS(Exchange, FITKGraphObjectConstraintCoupling);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   couplingData: The coupling data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-22
         */
        FITKGraphObjectConstraintCoupling(AbaqusData::FITKDataCase* caseData, Interface::FITKAbaConstraintCoupling* couplingData);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-22
         */
        virtual ~FITKGraphObjectConstraintCoupling();

        /**
         * @brief   Show or hide graph object.[override]
         * @param   visibility: The visibility of graph object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-08
         */
        void setVisible(bool visibility) override;

        /**
         * @brief   Highlight the coupling graph actors.[override]
         * @param   color: The given color for highlighting this time[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-30
         */
        void highlight(QColor color = QColor()) override;

        /**
         * @brief   Dis-highlight the coupling graph actors.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-30
         */
        void disHighlight() override;

        /**
         * @brief   Simplified the graph object if necessary.[override]
         * @param   enabled: Enabled simplified flag
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-07
         */
        void simplified(bool enabled) override;

        /**
         * @brief   Update the visibility with data object's visibility.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        void updateVisibility() override;

    private:
        /**
         * @brief   Initialize the actors.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-30
         */
        void initActors() override;

        /**
         * @brief   Generate the poly data for the coupling.[override]
         * @param   constraint: The coupling data object
         * @return  Is OK
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-22
         */
        bool generatePolyData(Interface::FITKInteractionLocation* constraint) override;

        /**
         * @brief   Generate constraint actor.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-22
         */
        void generateGraph() override;

    private:
        /**
         * @brief   The actor for control points' circle glyph.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-04-30
         */
        FITKGraphActor* m_fActorPointCircle{ nullptr };

        /**
         * @brief   The selection node for extract mesh grid.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        vtkSelectionNode* m_selectNodeLoc_1{ nullptr };

        /**
         * @brief   The selection for vtkSelectionNode.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        vtkSelection* m_sectionLoc_1{ nullptr };

        /**
         * @brief   The mesh grid extractor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        vtkExtractSelection* m_extractSelectionLoc_1{ nullptr };

        /**
         * @brief   The indice array of extract id.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        vtkIdTypeArray* m_idArrayLoc_1{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTCONSTRAINCOUPLING_H__
